using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class Air : Singleton<Air>, IInteractable
{
    // private void OnTriggerStay2D(Collider2D other)
    // {
    //     if (other.CompareTag("Player"))
    //     {
    //         if (Input.GetKeyDown(KeyCode.Space))
    //         {
    //             EventHandler.CallEndDive();
    //         }
    //     }
    // }
    public bool win;
    public string endScene;

    private bool isCarry;
    private GameObject carryPeople;
    
    private void OnEnable()
    {
        EventHandler.CarryPeople += OnCarryPeople;
    }

    private void OnDisable()
    {
        EventHandler.CarryPeople -= OnCarryPeople;
    }

    private void OnCarryPeople(GameObject people)
    {
        isCarry = true;
        carryPeople = people;
    }

    public void InteractAction()
    {
        if (isCarry)
        {
            Destroy(carryPeople);
            GameManager.Instance.rescuedPeople += 1;
        }
        
        EventHandler.CallReducedPressure("开始减压 ,休息等步骤");
        EventHandler.CallEndDive();
    }

    public void EndINteractACtion()
    {
        throw new NotImplementedException();
    }
}
